% SignalSlot.m
% 负责处理信号与槽的连接
classdef SignalSlot < handle
    properties
        appGUI
        fileHandler
    end
    
    methods
        function obj = SignalSlot(appGUI, fileHandler)
            % 构造函数：连接 GUI 和 文件处理逻辑
            obj.appGUI = appGUI;
            obj.fileHandler = fileHandler;
            
            % 设置按钮回调函数
            set(appGUI.buttonHandle, 'Callback', @(src, event)obj.onButtonClicked());
        end
        
        function onButtonClicked(obj)
            % 按钮点击回调：读取文件并显示内容
            content = obj.fileHandler.readFile();
            set(obj.appGUI.textArea, 'String', content);
        end
    end
end
